﻿using System;
using RAP.Framework.Libary.Utils;


namespace RAP.Framework.Libary.DomTemplateBuilder.Handler
{
	/// <summary>
	/// Property属性可代表多个属性值的处理对象
	/// </summary>
	public class MutiplePropertyHandler : PropertyElementHandler
	{
		protected string[ ] _propertyList = null;
		protected char[ ] _propertySplitChars = new char[ ] { ',', '|' };
		
		/// <summary>
		/// 获取多个属性
		/// </summary>
		public new string[ ] Property
		{
			get
			{
				if ( _propertyList == null )
				{
					if ( base.Property.IndexOfAny ( _propertySplitChars ) > 0 )
					{
						_propertyList = base.Property.Split ( _propertySplitChars, StringSplitOptions.RemoveEmptyEntries );
					}
					else if ( !base.Property.IsNullOrEmpty ( ) )
					{
						_propertyList = new string[ ] { base.Property };
					}
					else
					{
						_propertyList = new string[ ] { };
					}
				}
				return _propertyList;
			}
		}
	}
}
